﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jamhee.Noctiluca.WebServer
{
    public class DefaultWebConfiguration : WebConfiguration
    {
        protected const string INI_SECTION_WEBSITE_KEY_DEFAULTDOC = "default-doc";
        protected const string INI_SECTION_WEBSITE_KEY_VIRTUALDIR = "virtual-dir";

        public DefaultWebConfiguration(string filename)
            : base(filename)
        {
        }

        public string GetDefaultDocuments()
        {
            if (_iniFile != null && _iniFile.Exist())
            {
                return _iniFile.IniReadValue(INI_SECTION_WEBSITE, INI_SECTION_WEBSITE_KEY_DEFAULTDOC);
            }

            return string.Empty;
        }

        public string GetVirtualDirectories()
        {
            if (_iniFile != null && _iniFile.Exist())
            {
                return _iniFile.IniReadValue(INI_SECTION_WEBSITE, INI_SECTION_WEBSITE_KEY_VIRTUALDIR);
            }

            return string.Empty;
        }

        public override IWebResponser GetWebResponser()
        {
            return new DefaultWebResponser();
        }
    }
}
